home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
SK (Sockects) 1.4.1 r2
/
SK v1.4.1 r2.sit
/
SK 1.4.1 r2
/
CU
/
CU_Debug.c
next >
Wrap
Text File
|
1994-06-14
|
5KB
|
195 lines
/***************************************************************************
*
*
* (c) Copyright 1993, Decision Systems Group. All rights reserved.
*
* THIS IS A DEVELOPMENT VERSION: NOT FOR USE OR DISTRIBUTION OUTSIDE
* OF THE DECISION SYSTEMS GROUP
*
* This source code is owned by the Decision Systems Group. Copying or
* distributing any part of this file, electronically or otherwise,
* either in its original or derivative form, or altering or removing
* this copyright notice is in violation of federal and international
* copyright laws.
*
* ==========================================================================
*
* FILE: CU_Debug.c
*
* AUTHOR:
*
* Stephan R.A. Deibel
* YongJoon Lee
*
* CREATION DATE:
*
* 8/1/93
*
* VERSION:
*
* 6/13/94
*
* DESCRIPTION:
*
* Basic debugging utilities for cross-platform development that replace
* and augments some of the standard C "assert" code with generally
* safer alternatives.
*
* For usage instructions, read the embedded comments in the header file.
*
* MODIFICATIONS:
* --------------------------------------------------------------------------
* Date Name Description of modification
* --------------------------------------------------------------------------
*
* 3/11/94 Stephan Added header comments and fixed some formatting problems
* in the Mac implementation's output.
*
* 4/4/94 YJLee Fixed the printf output to shorts, because the Mac
* debugger prints out garbage long values.
*
* 4/5/94 YJLee Changed printf output to short ints for line nums to
* fix Mac problem.
*
* 3/15/94 Stephan Fixed text for UNFINISHED call -- was incorrect.
*
* 3/12/94 Stephan Fixed formatting of outputted messages for Mac.
*
* 6/13/94 Stephan Cosmetic / commenting
*
*/
#include "CU_Debug.h"
#include <stdlib.h>
#include <stdio.h>
#ifdef THINK_C
#include <pascal.h>
#endif
#ifdef __GNUC__
#include <signal.h>
#endif
/**************************************************************************/
/* GLOBALS */
#ifdef THINK_C
static char gDB_DebugStr[256];
#endif
/****************************************************************************
* FUNCTION:
*
* _DB_Assert
*
* DESCRIPTION:
*
* Enter resident debugger and print an message indicating that an ASSERT
* macro has encountered an invalid condition. The file and line number
* of the ASSERT macro are given.
*
* PARAMETERS:
*
* char * -- The file name in which the error occurred
* unsigned int -- The line number on which the error occurred.
*
*/
void
_DB_Assert(char *file_name, unsigned int line_num)
{
#ifdef THINK_C
sprintf(gDB_DebugStr, "Assertion failed: %s, line %hu", file_name,
line_num);
DebugStr (CtoPstr(gDB_DebugStr));
ExitToShell();
#endif /* THINK_C*/
#ifdef __GNUC__
/* Print error message to standard error */
fprintf(stderr, "\nAssertion failed: %s, line %hu\n", file_name,
line_num);
/* Send an interrupt signal to the current proccess */
kill(getpid(), SIGINT);
#endif /* __GNUC__ */
}
/****************************************************************************
* FUNCTION:
*
* _DB_Unimplemented
*
* DESCRIPTION:
*
* Enter resident debugger and print an message indicating that an
* UNIMPLEMENTED macro has been encountered.
*
* PARAMETERS:
*
* char * -- The file name in which the error occurred
* unsigned int -- The line number on which the error occurred.
*
*/
void
_DB_Unimplemented(char *file_name, unsigned int line_num)
{
#ifdef THINK_C
sprintf(gDB_DebugStr, "Unimplemented routine: %s, line %hu",
file_name, line_num);
DebugStr(CtoPstr(gDB_DebugStr));
ExitToShell();
#endif /* THINK_C*/
#ifdef __GNUC__
fprintf(stderr, "\nUnimplemented routine: %s, line %hu\n",
file_name, line_num);
/* send an interrupt signal to the current proccess */
kill(getpid(), SIGINT);
#endif /* __GNUC__ */
}
/****************************************************************************
* FUNCTION:
*
* _DB_Unfinished
*
* DESCRIPTION:
*
* Similar to UNIMPLEMENTED execpt it will not crash the system.
*
*
* PARAMETERS:
*
* char * -- The file name in which the error occurred
* unsigned int -- The line number on which the error occurred.
*
*/
void
_DB_Unfinished(char *file_name, unsigned int line_num)
{
#ifdef THINK_C
sprintf(gDB_DebugStr, "Unfinished code in routine: %s, line %hu\n",
file_name, line_num);
fprintf(stderr, "%s", gDB_DebugStr);
#endif /* THINK_C*/
#ifdef __GNUC__
fprintf(stderr, "\nUnfinished code in routine: %s, line %hu\n",
file_name, line_num);
#endif /* __GNUC__ */
}
/* end of CU_Debug.c */